﻿@model sBlog.Net.Domain.Entities.VideoEntity
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<style>
    .text-box
    {
        width: 80%;
        height: 30px;
        }
</style>
<script type="text/javascript">
    $(window).load(
    function () {
        $("#dvUploadVideo").fileUpload({
            'uploader': '/Scripts/uploader.swf',
            'cancelImg': '/Content/Images/cancel.png',
            'buttonText': 'Upload video',
            'script': '@Url.Action("UploadVideo")',
            'onComplete': function (event, queueID, fileObj, response, data) {
                var videoName = response.substring(6, response.length);
                $("#VideoName").val(videoName);
                var folder = response.substring(0, 5);
                $("#Folder").val(folder);
                var uploadVideoDone = document.getElementById("uploadVideoDone");
                uploadVideoDone.innerHTML = response;
            },
            'folder': '/UploadVideos',
            'fileDesc': 'Video Files',
            'fileExt': '*.mp4',
            'multi': false,
            'auto': true
        });
    }
);
</script>
<div style="height: 50px;">
    &nbsp;
</div>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    
    @Html.HiddenFor(model => model.Id)
    @Html.Hidden("Folder", ViewData["Folder"])
    <div class="editor-label">
        @Html.LabelFor(model => model.VideoTitle)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.VideoTitle)
        @Html.ValidationMessageFor(model => model.VideoTitle)
    </div>
    <div id="uploadVideoDone">
    </div>
    <div>
        <div style="float: left; margin-top: 10px; margin-right: 65px;">
            <b>@Html.Raw("VideoName")</b>
        </div>
        <div id="dvUploadVideo">
            @Html.Hidden("VideoName", ViewData["VideoName"])
        </div>
    </div>
    <p>
        <input type="submit" value="Save" />
    </p>
}
